package com.duapk.search.work;

import java.util.Map;

import org.apache.lucene.document.FieldSelector;
import org.apache.lucene.document.FieldSelectorResult;

import com.duapk.search.bean.ReturnField;


/**
 * 索引字段筛选器
 * 
 * @Package: com.duapk.search.work
 * @ClassName: ApkFieldSelector
 * @author: jiangzheng
 * @date: Apr 4, 2011 10:08:37 PM
 * 
 */
@SuppressWarnings("serial")
public class ApkFieldSelector implements FieldSelector {

	private Map<String, ReturnField> returnFields;

	public ApkFieldSelector(Map<String, ReturnField> returnFields) {
		this.returnFields = returnFields;
	}

	public FieldSelectorResult accept(String fieldName) {
		if (returnFields.containsKey(fieldName)) {
			return FieldSelectorResult.LOAD;
		}
		return FieldSelectorResult.NO_LOAD;
	}
}
